from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from projectadmin.crm.models import *

urlpatterns = \
    patterns('',

    url(r'^$', direct_to_template, {"template": "crm/home.html"}, name="crm_home"),
    url(r'^client/add/$', 'crm.views.client_form', name="crm_client_add"),
    url(r'^client/list/$', 'django.views.generic.list_detail.object_list', {'queryset' : Client.objects.all(), }, name="crm_client_list"),
    url(r'^client/(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', {'queryset' : Client.objects.all(), }, name="crm_client_detail"),
    url(r'^client/(?P<client_id>\d+)/edit/$', 'crm.views.client_form', name="crm_client_edit"),
    
    url(r'^client/tagged/(?P<tag_name>.+)/$', 'crm.views.tagged_client', name="crm_tagged_client"),
    
    url(r'^client/import/$', 'crm.views.client_import', name="crm_import_client"),

    url(r'^organisation/add/$', 'crm.views.organisation_form', name="crm_organisation_add"),
    url(r'^organisation/list/$', 'django.views.generic.list_detail.object_list', {'queryset' : Organisation.objects.all(),}, name="crm_organisation_list"),
    url(r'^organisation/(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', {'queryset' : Organisation.objects.all(), }, name="crm_organisation_detail"),
    url(r'^organisation/(?P<org_id>\d+)/edit/$', 'crm.views.organisation_form', name="crm_organisation_edit"),

    url(r'^organisation/tagged/(?P<tag_name>.+)/$', 'crm.views.tagged_organisation', name="crm_tagged_organisation"),

    url(r'^search$', 'crm.views.search_form', name="crm_search"),
    )

